

USE [WebSecurity]
GO

GO
-- Drop stored procedure if it already exists
IF EXISTS (
  SELECT * 
    FROM INFORMATION_SCHEMA.ROUTINES 
   WHERE SPECIFIC_CATALOG = N'WebSecurity' 
	 AND SPECIFIC_SCHEMA = N'dbo'
     AND SPECIFIC_NAME = N'Application_ins' 
)
   DROP PROCEDURE dbo.Application_ins
GO
create procedure Application_ins

	@ApplicationID Int = null OUTPUT,
	@ApplicationName NVarChar(100),
	@CreatedBy VarChar(50),
	@CreatedDt DateTime,
	@ModifiedBy VarChar(50),
	@ModifiedDt DateTime,
        @RowsAffected int = null OUTPUT 
	
--*************************************************************
--Created By: trooks
--Name: dbo_Application_ins
--Schema: dbo
--Table: Application
--Database: WebSecurity
--Created Date: 01/21/2013 00:00:00
--*************************************************************

as
	Begin Try
        insert into [dbo].Application
		(
		ApplicationName, 
		CreatedBy, 
		CreatedDt, 
		ModifiedBy, 
		ModifiedDt 
    )
    values
    (
		@ApplicationName, 
		@CreatedBy, 
		@CreatedDt, 
		@ModifiedBy, 
		@ModifiedDt 
        )
		Set @ApplicationID = SCOPE_IDENTITY(); 
		Set @RowsAffected = @@ROWCOUNT;
		return 0;	
	END TRY
	BEGIN CATCH
		Set @RowsAffected = 0;
		EXEC dbo.uspLogError;
		return -1;
	END CATCH
	
GO
GRANT EXECUTE ON [WebSecurity].[dbo].[Application_ins] to PORTAL_WebSecurity
GO




